# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgbase=libxml++-5.0
pkgname=(libxml++-5.0 libxml++-5.0-docs)
pkgver=5.0.1
pkgrel=1
pkgdesc="C++ bindings to libxml2"
url="https://libxmlplusplus.github.io/libxmlplusplus/"
arch=(x86_64)
license=(LGPL)
depends=(libxml2 gcc-libs)
makedepends=(git meson mm-common)
options=(!emptydirs)
_commit=4caece92ce2d09cfb6fbc87180ec768ccf3bf718  # tags/5.0.1^0
source=("git+https://github.com/libxmlplusplus/libxmlplusplus#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd libxmlplusplus
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd libxmlplusplus
}

build() {
  arch-meson libxmlplusplus build -D maintainer-mode=true
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_libxml++-5.0() {
  provides=(libxml++-5.0.so)

  meson install -C build --destdir "$pkgdir"

  # Split -docs
  mkdir -p docs/usr/share
  mv -t docs/usr/share "$pkgdir"/usr/share/{devhelp,doc}
}

package_libxml++-5.0-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  options=(!strip)

  mv -t "$pkgdir" docs/*
}
